package com.nachsparty.keepmychange.net;

import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.nachsparty.keepmychange.SplashScreenActivity;


public class NetworkManager {
	
	private static final String CONNECTIVITY_SERVICE = "connectivity";
//	private static NumberFormat formatter = new DecimalFormat("00000000");

	public static boolean isOnline() {
		try {
			ConnectivityManager cm = (ConnectivityManager) SplashScreenActivity.sharedInstance.getSystemService(CONNECTIVITY_SERVICE);
			boolean online;

			NetworkInfo ninfo = cm.getActiveNetworkInfo();
			if (ninfo == null) {
				return false;
			} else {
				online = ninfo.isAvailable();
			}
			return online;
		} catch (Throwable e) {
			e.printStackTrace();
		}
		return false;
	}
}